package cn.iocoder.yudao.module.product.dal.mysql.productmanagement;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.product.dal.dataobject.productmanagement.ProductManagementDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.product.controller.admin.productmanagement.vo.*;

/**
 * 产品 Mapper
 *
 * @author wcl
 */
@Mapper
public interface ProductManagementMapper extends BaseMapperX<ProductManagementDO> {

    default PageResult<ProductManagementDO> selectPage(ProductManagementPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductManagementDO>()
                .likeIfPresent(ProductManagementDO::getName, reqVO.getName())
                .eqIfPresent(ProductManagementDO::getSpec, reqVO.getSpec())
                .eqIfPresent(ProductManagementDO::getEncode, reqVO.getEncode())
                .eqIfPresent(ProductManagementDO::getState, reqVO.getState())
                .betweenIfPresent(ProductManagementDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProductManagementDO::getId));
    }

}
